package com.asiainfo.kbisheet.components.condition
{
	import com.asiainfo.kbisheet.components.condition.check.ConditionInputCheck;
	import com.asiainfo.kbisheet.components.condition.date.ConditionInputDate;
	import com.asiainfo.kbisheet.components.condition.ddlist.ConditionInputDDList;
	import com.asiainfo.kbisheet.components.condition.hidden.ConditionInputHidden;
	import com.asiainfo.kbisheet.components.condition.month.ConditionInputMonth;
	import com.asiainfo.kbisheet.components.condition.text.ConditionInputText;
	import com.asiainfo.kbisheet.control.MessageControl;

	public class ConditionInputFactory
	{
		public static function create(parent:ConditionItem, type:String):ConditionInput{
			var messageControl:MessageControl = new MessageControl();
			var conditionInput:ConditionInput;			
			switch(type){
				case CONDITION_TYPE.DATE:
					messageControl.updateMessage("ConditionItem:createInputComponent:日期选择...");
					conditionInput =  new ConditionInputDate(parent);
					break;
				case CONDITION_TYPE.MONTH:
				case CONDITION_TYPE.MONTH_OLD:
					messageControl.updateMessage("ConditionItem:createInputComponent:月选择...");
					conditionInput =  new ConditionInputMonth(parent);
					break;
				case CONDITION_TYPE.DDLIST:
					messageControl.updateMessage("ConditionItem:createInputComponent:下拉选择...");
					conditionInput = new ConditionInputDDList(parent);
					break;
				case CONDITION_TYPE.TEXT:
					messageControl.updateMessage("ConditionItem:createInputComponent:文本框...");
					conditionInput = new ConditionInputText(parent);
					break;
				case CONDITION_TYPE.CHECK:
					messageControl.updateMessage("ConditionItem:createInputComponent:选择框...");
					conditionInput = new ConditionInputCheck(parent);
					break;
				case CONDITION_TYPE.HIDDEN:
					messageControl.updateMessage("ConditionItem:createInputComponent:隐藏框...");
					conditionInput = new ConditionInputHidden(parent);
					break;
				default:
					messageControl.updateMessage("ConditionItem:createInputComponent:未知类型...");
			}
			return conditionInput;
		}
	}
}